package com.example.chatrecommendation.tool;

/**
 * @author Jasmine-drs
 * @date 2024/5/17 8:53
 */
public enum QuestionType {
	PERCEIVE("认知", "perceive"),
	INNOVATE("创新", "innovate"),
	PRACTICE("实践", "practice"),
	EXPRESSION("表达", "expression"),
	CRITICIZE("批判", "criticize");

	private String chineseDescription;
	private String englishDescription;

	QuestionType() {
	}

	QuestionType(String chineseDescription, String englishDescription) {
		this.chineseDescription = chineseDescription;
		this.englishDescription = englishDescription;
	}

	public String getChineseDescription() {
		return this.chineseDescription;
	}

	public String getEnglishDescription() {
		return this.englishDescription;
	}

	public static String toChinese(String english) {
		for (QuestionType skill : QuestionType.values()) {
			if (skill.englishDescription.equalsIgnoreCase(english)) {
				return skill.chineseDescription;
			}
		}
		throw new IllegalArgumentException("No constant with description " + english + " found");
	}

	public static String toEnglish(String chinese) {
		for (QuestionType skill : QuestionType.values()) {
			if (skill.chineseDescription.equalsIgnoreCase(chinese)) {
				return skill.englishDescription;
			}
		}
		throw new IllegalArgumentException("No constant with description " + chinese + " found");
	}

	@Override
	public String toString() {
		return this.chineseDescription + " (" + this.englishDescription + ")";
	}
}
